#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@File    ：eaxm.py
@Author  ：Juff
@Date    ：2023/10/16 14:27 
'''

# 5、使用Python在mysql中创建一个user表，字段包含id,name。并向表中插入一条数据。
import pymysql

conn = pymysql.connect(host="master",user="root",password="123456",port=3306,db='stu')
cursor = conn.cursor()
create_sql = "create table if not exists user(id int,name varchar(255))"
cursor.execute(create_sql)

insert_sql = 'insert into user values(1,"zs")'
cursor.execute(insert_sql)
conn.commit()

cursor.close()
conn.close()



